<template>
  <basic-container>
    <header>
      <el-row>
        <el-col :span="10" align="start">工作指引编辑</el-col>
        <el-col :span="14" align="end">
          <el-button @click="$router.back()">取消退出</el-button>
          <el-button type="primary" @click="submitHandle">保存关闭</el-button>
        </el-col>
      </el-row>
    </header>
    <div class="container">
      <el-card class="box-card">
        <template #header>
          <div class="card-header">
            <span>工作指引对象</span>
          </div>
        </template>
        <p>{{ state.date }}</p>
      </el-card>
      <el-card class="box-card">
        <template #header>
          <div class="card-header">
            <span>工作指引步骤设置</span>
          </div>
        </template>
        <div v-for="item in stepList" :key="item.index" class="text item">
          <el-row>
            <el-col :span="6">
              <img class="zybz-img" src="@/assets/images/business-system/work-manage-lczybz.png" />
              {{ item.index }}
            </el-col>
            <el-col :span="6">
              <h4>步骤名称</h4>
              <el-input v-model="item.name" placeholder="请填写步骤名称" />
            </el-col>
            <el-col :span="6">
              <h4>步骤说明</h4>
              <el-input v-model="item.remarks" placeholder="请填写步骤说明" />
            </el-col>
            <el-col :span="6">
              <h4>跳转菜单</h4>
              <el-select v-model="item.menu" class="m-2" placeholder="请选择跳转菜单" size="large">
                <el-option v-for="item in options" :key="item.menu" :label="item.label" :value="item.value" />
              </el-select>
            </el-col>
          </el-row>
        </div>
      </el-card>
    </div>
  </basic-container>
</template>
<script setup>
const stepList = ref([
  {
    index: '步骤环节1',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节2',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节3',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节4',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节5',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节6',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节7',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节8',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节9',
    name: '',
    remarks: '',
    menu: '',
  },
  {
    index: '步骤环节10',
    name: '',
    remarks: '',
    menu: '',
  },
]);
const options = ref([
  {
    value: 'Option1',
    label: 'Option1',
  },
  {
    value: 'Option2',
    label: 'Option2',
  },
  {
    value: 'Option3',
    label: 'Option3',
  },
  {
    value: 'Option4',
    label: 'Option4',
  },
  {
    value: 'Option5',
    label: 'Option5',
  },
]);

// 提交方法
// 接收父页面的传值操作
const router = useRouter();
const route = router.currentRoute.value;
console.log('查询参数值：', JSON.parse(route.query.v));
const state = ref(JSON.parse(route.query.v));
const submitHandle = () => {
  console.log('填写内容', stepList);
  router.go(-1);
};
</script>
<style lang="scss" scoped>
header {
  .el-col-10 {
    background-color: #f0f2f5;
    font-size: 16px;
    font-family: SourceHanSansSC-Bold, SourceHanSansSC;
    font-weight: bold;
    color: #25292c;
    line-height: 42px;
    height: 50px;
  }
  .el-col-14 {
    background-color: #f0f2f5;
    height: 50px;
    padding-right: 20px;
  }
}
.container {
  height: calc(100vh - 208px);
  .el-card {
    border: 1px solid #d9dce4 !important;
    margin: 15px;
    font-size: 14px;
    font-family: SourceHanSansSC-Medium, SourceHanSansSC;
    font-weight: 500;
    color: #25292c;
    line-height: 20px;
  }
  .el-card__header {
    height: 60px;
    background: #f6f8fa !important;
    margin-bottom: 10px;
  }
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .text {
    font-size: 14px;
    margin-left: 20px;
    font-size: 14px;
    font-family: SourceHanSansSC-Regular, SourceHanSansSC;
    font-weight: 400;
    color: #50565d;
    line-height: 20px;
    .el-row {
      height: 35px !important;
    }
    .el-col-6:nth-child(1) {
      height: 60px;
      line-height: 60px;
    }
    h4 {
      display: inline-block;
      margin-right: 20px;
    }
    .el-input {
      display: math;
      vertical-align: initial;
      width: 100%;
    }
  }
  .item {
    margin-bottom: 18px;
  }
  .box-card {
    width: 98%;
    p {
      margin-left: 20px;
      font-size: 14px;
      font-family: SourceHanSansSC-Regular, SourceHanSansSC;
      font-weight: 400;
      color: #50565d;
      line-height: 20px;
    }
  }
}
.zybz-img {
  margin-right: 10px;
  width: 15px;
  vertical-align: middle;
}
</style>
